 <?php 
 require 'config.php';

	$db_handle = mysql_connect($server, $user_name, $pass_word);
	$db_found = mysql_select_db($database, $db_handle);


 $secret = "35onoi2=-7#%g03kl";
if (md5($_GET['email'].$secret) == $_GET['hash']) {
    //Update user to verified.
	$email = $_GET['email'];
		if ($db_found) {$sqlver = "UPDATE members SET verified = '1' WHERE email LIKE \"$email\"";
		if($resultver = mysql_query($sqlver)){$happymessage="You have been verified";mysql_close($db_handle);}else{$errorMessage = "This page was not accessed via a legitimate link";mysql_close($db_handle);}}
		else {
	$errorMessage = "The database could not be modified with verification";}
}
else
{	$errorMessage = "This page was not accessed via a legitimate link, no verification was authorised";}

 ?> 
 
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <title>iPetty Login</title>
  
  
  
  <link rel="stylesheet" href="/jquery/style.css">
  
  <!-- Extra Codiqa features -->
  <link rel="stylesheet" href="codiqa.ext.css"><style type="text/css">

  </style>
  <link href="styling.css" rel="stylesheet" type="text/css">
  <!-- jQuery and jQuery Mobile -->
  <script src="https://d10ajoocuyu32n.cloudfront.net/jquery-1.9.1.min.js"></script>
  <script src="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>

  <!-- Extra Codiqa features -->
  <script src="https://d10ajoocuyu32n.cloudfront.net/codiqa.ext.js"></script>
   
</head>
<body>
<!-- Home -->
<div data-role="page" id="page1">
    <div data-theme="a" data-role="header">
        <h3>
            iPetty
        </h3>
    </div>
    <h4 align="center" style="color:#F00"><? echo $errorMessage; ?> </h4>
    <h4 align="center" style="color:#0C3"><? echo $happymessage; ?> </h4>
    <div data-role="content">
    <FORM NAME ="formilate" METHOD ="POST" ACTION ="index.php" id="log">
    <div data-role="fieldcontain">

            <input name="companyid" id="companyid" placeholder="Company ID" value="" type="text" required class="number">
        </div>
        <div data-role="fieldcontain">

            <input name="email" id="email" placeholder="Email" value="" type="email" required class="email">
        </div>
        <div data-role="fieldcontain">
            <input name="password" id="password" placeholder="Password" value="" type="password" required>
        </div>
        <INPUT TYPE = "Submit" Name = "Submit1"  VALUE = "Log In">


</FORM>
<script src="jquery.validate.js"></script>
<script>
$("#log").validate();
</script>
    </div>
    <p align="center"><a href="iforget.php">Forgot your password?</a></p>
   <strong><p align="center"> If your company does not have an account yet, please <a href="register.php">register</a></p></strong>
</div>
</body>
</html>
